package config

import (
	"reflect"
)

// ==================
// config-bean_definition: bean定义
// ==================

const (
	// SCOPE_SINGLETON 单例
	SCOPE_SINGLETON = "singleton"
	// SCOPE_PROTOTYPE 原型
	SCOPE_PROTOTYPE = "prototype"
)

// META 标识类型
type META struct {
}

// Scoop 作用域 singleton prototype request session
type Scoop string

// BeanDefinition bean 定义
type BeanDefinition interface {
	// GetBeanName 获取bean 名称
	GetBeanName() string
	GetTypeName() string
	// GetBeanValue 获取实例
	GetBeanValue() reflect.Value
	// GetBeanType 获取 bean type
	GetBeanType() reflect.Type
}

// beanDefinition bean 定义
type beanDefinition struct {
	name     string
	beanType reflect.Type
	// beanValue 非不要属性
	beanValue reflect.Value
	typeName  string
	scope     string
	primary   bool
}

// GetBeanName bean name
func (receiver *beanDefinition) GetBeanName() string {
	return receiver.name
}

// GetTypeName bean type name
func (receiver *beanDefinition) GetTypeName() string {
	return receiver.typeName
}

// GetBeanValue bean value
func (receiver *beanDefinition) GetBeanValue() reflect.Value {
	return receiver.beanValue
}

// GetBeanType bean type
func (receiver *beanDefinition) GetBeanType() reflect.Type {
	return receiver.beanType
}

// BeanDefinitionCustomize bean 定义自定义
type BeanDefinitionCustomize func(BeanDefinition)
